package com.auxgroup.hr.front.commons.exception;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.auxgroup.hr.front.commons.BaseRetCode;

public class ValidationException extends FrontException {

	/**
	 * @param errors
	 */
	public ValidationException(List<VailidationMsg> errors) {
		super(BaseRetCode.CODE_ERROR_FORM_VALIDATION);
		this.errors = errors;
	}

	public ValidationException(String field, String msg) {
		super(BaseRetCode.CODE_ERROR_FORM_VALIDATION);
		List<VailidationMsg> errors = new ArrayList<VailidationMsg>();
		errors.add(new VailidationMsg(field,msg));
		this.errors = errors;
	}

	@SuppressWarnings("unchecked")
	private List<VailidationMsg> errors = Collections.EMPTY_LIST;

	private static final long serialVersionUID = 1L;

	public List<VailidationMsg> getErrors() {
		return errors;
	}

}
